<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.gzbugu.bugusys.vo.StaffFamily"%>
<%@page import="com.gzbugu.bugusys.vo.StaffEducation"%>
<%@page import="com.gzbugu.bugusys.vo.StaffExperience"%>
<%@page import="com.gzbugu.bugusys.vo.StaffCertificate"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   <base href="<%=basePath%>">
  	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  	<script language="javascript" type="text/javascript" src="<%=basePath%>datemaker/WdatePicker.js"></script>
  	<script type="text/javascript" src="<%=basePath%>manage/js/jquery.js"></script>
	<script type="text/javascript" src="<%=basePath%>manage/js/addTravel.js"></script>
	<script type="text/javascript" src="<%=basePath%>manage/js/addStaff.js"></script>
	<script type="text/javascript" src="<%=basePath%>manage/js/formStaff.js"></script>
	<link rel="stylesheet" type="text/css" href="<%=basePath%>manage/css/addStaff.css"></link>

  </head>
  <h1 class="tableTitle">员工入职登记</h1>
<center>
  <body>
    
    <s:actionerror/>
    <s:fielderror></s:fielderror>
	<s:iterator value="errorList">
    	<s:property/>
    </s:iterator>
    <form action="staffRegister" method="post"  enctype="multipart/form-data" onsubmit="return checkLogin()">
    	<table >
			<tbody>
    		<tr>
    			<td rowspan="9" style="font-size:20px" bgcolor="#eef6ff">员&nbsp;工&nbsp;入&nbsp;职&nbsp;登&nbsp;记</td>
    			<td ><span class="emphasize">*</span>&nbsp;员工姓名</td>
    			<td ><input type="text" name="staffDTO.staffName" id="staffName" value="${staff.name}"/></td>
    			<td id="textSize" >身份证号码</td>
    			<td ><input type="text" maxlength="18" name="staffDTO.staffIdnumber" onblur="valiIdCard(this.value)" value="${staff.idnumber}"/></td>
    			<td rowspan="6"><img src="manage/images/userNomal.png" width="100" height="100" />
    			                <input type="file" name="photo"/><br>相&nbsp;&nbsp;&nbsp;片</td>
    		</tr>
			
    		<tr>
  				<td >入职部门</td>
  				<td ><input type="text" name="staffDTO.staffDepartment"  value="${staff.department}"/></td>				
  				<td >入职岗位</td>
  				<td ><input type="text" name="staffDTO.staffPost" value="${staff.post}"/></td>
  			</tr>
			
  			<tr>
  				<td >入职日期</td>
  				<td ><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffHiredate" value="${staff.hiredate}"/></td>
  				<td ><span class="emphasize">*</span>&nbsp;员工编号</td>
  				<td ><input type="text" name="staffDTO.staffId" id="staffId" value="${staff.staffId}"/></td>
  			</tr>


  			<tr>
  				<td >性&nbsp;&nbsp;&nbsp;&nbsp;别</td>
  				<td>
  					<input type="radio"  name="staffDTO.staffSexId" checked="checked" value="1"/>男
  					<input type="radio" name="staffDTO.staffSexId" value="2" <s:if test="staff.sex == 3">checked="checked"</s:if>/>女
  				</td>
  				<td >曾用名</td>
  				<td ><input type="text" name="staffDTO.staffFormername"  value="${staff.formername}"/></td>
  			</tr>
			
			
  			<tr>
  				<td >出生地</td>
  				<td ><input type="text" name="staffDTO.staffBirthplace" value="${staff.birthplace}"/></td>
  				<td >民&nbsp;&nbsp;&nbsp;&nbsp;族</td>
  				<td ><input type="text" name="staffDTO.staffNation" value="${staff.nation}"/></td>
  			</tr>
			
  			<tr>
  				<td >出生年月</td>
  				<td><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffBirthday" value="${staff.birthday}"/></td>
  				<td >政治面貌</td>
  				<td>
					 <select name="staffDTO.staffPoliticsStatus" >
					  <option selected="selected">中共党员</option>
					  <option <s:if test="staff.politicsStatus == '中共团员'">selected="selected"</s:if>>中共团员</option>
					  <option <s:if test="staff.politicsStatus == '其他党派'">selected="selected"</s:if>>其他党派</option>
					  <option <s:if test="staff.politicsStatus == '群众'">selected="selected"</s:if>>群众</option>
					</select>
				</td>
  			</tr>
			
			
  			<tr>
  				<!--<td >邮箱</td>
  				<td><input type="text" name="email" onBlur="checkEmail()"/><font color="#FF0000"><span id="errorEmail"></span></font></td>  -->
  				<td>联系电话</td>
  				<td><input type="text" name="staffDTO.staffTel" value="${staff.tel}"/></td>
  				<td >籍&nbsp;&nbsp;&nbsp;&nbsp;贯</td>
  				<td colspan="2"><input type="text" size="40" name="staffDTO.staffNativePlace" value="${staff.nativePlace}"/></td>
  			</tr>
			
  			<tr>
  				<td >邮&nbsp;&nbsp;&nbsp;&nbsp;编</td>
  				<td ><input type="text" size="20" name="staffDTO.staffZip" value="${staff.zip}"/> </td>
  				<td >现住址</td>
  				<td colspan="2"><input type="text" size="40"  name="staffDTO.staffAddress" value="${staff.address}"/></td>
  			</tr>
			
			
  			<tr>
  				<td >学&nbsp;&nbsp;&nbsp;&nbsp;历</td>
  				<td ><input type="text" size="20" name="staffDTO.staffEducation" value="${staff.education}"/></td>
  				<td >毕业院校</td>
  				<td colspan="2"><input type="text" size="40"  name="staffDTO.staffGraduateSchool" value="${staff.graduateSchool}"/></td>
  			</tr>

			<%
				Object[] families = new StaffFamily[0];;
				if(request.getAttribute("familySet")!=null){
					families = ((Set)request.getAttribute("familySet")).toArray();
				}
			 %>
    		<tr>
    			<td rowspan="4" style="font-size:20px" bgcolor="#eef6ff">家庭成员</td>
    			<td >姓&nbsp;&nbsp;&nbsp;&nbsp;名</td>
    			<td >与本人关系</td>
    			<td >单&nbsp;&nbsp;&nbsp;&nbsp;位</td>
    			<td  colspan="2">职&nbsp;&nbsp;&nbsp;&nbsp;务</td>
    		</tr>
    		<tr>
    			<td><input type="text" name="staffDTO.staffFamilyName1" value="<%=families.length>0?((StaffFamily)(families[0])).getName():"" %>"/></td>
    			<td><input type="text" name="staffDTO.staffFamilyRelationship1" value="<%=families.length>0?((StaffFamily)(families[0])).getRelationship():"" %>"/></td>
    			<td><input type="text" name="staffDTO.staffFamilyUnit1" value="<%=families.length>0?((StaffFamily)(families[0])).getUnit():"" %>"/></td>
    			<td colspan="2"><input type="text" name="staffDTO.staffFamilyPost1" value="<%=families.length>0?((StaffFamily)(families[0])).getPost():"" %>"/></td>
    		</tr>
    		<tr>
    			<td><input type="text" name="staffDTO.staffFamilyName2" value="<%=families.length>1?((StaffFamily)(families[1])).getName():"" %>"/></td>
    			<td><input type="text" name="staffDTO.staffFamilyRelationship2" value="<%=families.length>1?((StaffFamily)(families[1])).getRelationship():"" %>"/></td>
    			<td><input type="text" name="staffDTO.staffFamilyUnit2" value="<%=families.length>1?((StaffFamily)(families[1])).getUnit():"" %>"/></td>
    			<td colspan="2"><input type="text" name="staffDTO.staffFamilyPost2" value="<%=families.length>1?((StaffFamily)(families[1])).getPost():"" %>"/></td>
    		</tr>
    		<tr>
    			<td><input type="text" name="staffDTO.staffFamilyName3" value="<%=families.length>2?((StaffFamily)(families[2])).getName():"" %>"/></td>
    			<td><input type="text" name="staffDTO.staffFamilyRelationship3" value="<%=families.length>2?((StaffFamily)(families[2])).getRelationship():"" %>"/></td>
    			<td><input type="text" name="staffDTO.staffFamilyUnit3" value="<%=families.length>2?((StaffFamily)(families[2])).getUnit():"" %>"/></td>
    			<td colspan="2"><input type="text" name="staffDTO.staffFamilyPost3" value="<%=families.length>2?((StaffFamily)(families[2])).getPost():"" %>"/></td>
    		</tr>

			<%
				Object[] educations = new StaffEducation[0];;
				if(request.getAttribute("educationSet")!=null){
					educations = ((Set)request.getAttribute("educationSet")).toArray();
				}
			 %>
    		<tr>
    			<td rowspan="4" style="font-size:20px" bgcolor="#eef6ff">教&nbsp;育&nbsp;背&nbsp;景</td>
    			<td >开始时间</td>
    			<td >结束时间</td>
    			<td >所在院校</td>
    			<td  colspan="2">证明人</td>
    		</tr>
    		<tr>
    			<td><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffEducationStart1" value="<%=educations.length>0?((StaffEducation)(educations[0])).getStart():"" %>"/></td>
    			<td><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffEducationEnd1" value="<%=educations.length>0?((StaffEducation)(educations[0])).getEnd():"" %>"/></td>
    			<td><input type="text" name="staffDTO.staffEducationSchool1" value="<%=educations.length>0?((StaffEducation)(educations[0])).getSchool():"" %>"/></td>
    			<td colspan="2"><input type="text" name="staffDTO.staffEducationReference1"/ value="<%=educations.length>0?((StaffEducation)(educations[0])).getReference():"" %>"></td>
    		</tr>
    		<tr>
    			<td><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffEducationStart2" value="<%=educations.length>1?((StaffEducation)(educations[1])).getStart():"" %>"/></td>
    			<td><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffEducationEnd2" value="<%=educations.length>1?((StaffEducation)(educations[1])).getEnd():"" %>"/></td>
    			<td><input type="text" name="staffDTO.staffEducationSchool2" value="<%=educations.length>1?((StaffEducation)(educations[1])).getSchool():"" %>"/></td>
    			<td colspan="2"><input type="text" name="staffDTO.staffEducationReference2"/ value="<%=educations.length>1?((StaffEducation)(educations[1])).getReference():"" %>"></td>
    		</tr>
    		<tr>
    			<td><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffEducationStart3" value="<%=educations.length>2?((StaffEducation)(educations[2])).getStart():"" %>"/></td>
    			<td><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffEducationEnd3" value="<%=educations.length>2?((StaffEducation)(educations[2])).getEnd():"" %>"/></td>
    			<td><input type="text" name="staffDTO.staffEducationSchool3" value="<%=educations.length>2?((StaffEducation)(educations[2])).getSchool():"" %>"/></td>
    			<td colspan="2"><input type="text" name="staffDTO.staffEducationReference3"/ value="<%=educations.length>2?((StaffEducation)(educations[2])).getReference():"" %>"></td>
    		</tr>

			<%
				Object[] experiences = new StaffExperience[0];;
				if(request.getAttribute("experienceSet")!=null){
					experiences = ((Set)request.getAttribute("experienceSet")).toArray();
				}
			 %>
    		<tr>
    			<td rowspan="4" style="font-size:20px" bgcolor="#eef6ff">工&nbsp;作&nbsp;经&nbsp;历</td>
    			<td >开始时间</td>
    			<td >结束时间</td>
    			<td >所在单位</td>
    			<td  colspan="2">职&nbsp;&nbsp;&nbsp;&nbsp;务</td>
    			
    		</tr>
    		<tr>
    			<td><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffExperienceStart1" value="<%=experiences.length>0?((StaffExperience)(experiences[0])).getStart():"" %>""/></td>
    			<td><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffExperienceEnd1" value="<%=experiences.length>0?((StaffExperience)(experiences[0])).getEnd():"" %>"/></td>
    			<td><input type="text" name="staffDTO.staffExperienceUnit1" value="<%=experiences.length>0?((StaffExperience)(experiences[0])).getUnit():"" %>"/></td>
    			<td colspan="2"><input type="text" name="staffDTO.staffExperiencePost1" value="<%=experiences.length>0?((StaffExperience)(experiences[0])).getPost():"" %>"/></td>
    		</tr>
    		<tr>
    			<td><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffExperienceStart2" value="<%=experiences.length>1?((StaffExperience)(experiences[1])).getStart():"" %>""/></td>
    			<td><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffExperienceEnd2" value="<%=experiences.length>1?((StaffExperience)(experiences[1])).getEnd():"" %>"/></td>
    			<td><input type="text" name="staffDTO.staffExperienceUnit2" value="<%=experiences.length>1?((StaffExperience)(experiences[1])).getUnit():"" %>"/></td>
    			<td colspan="2"><input type="text" name="staffDTO.staffExperiencePost2" value="<%=experiences.length>1?((StaffExperience)(experiences[1])).getPost():"" %>"/></td>
    		</tr>
    		<tr>
    			<td><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffExperienceStart3" value="<%=experiences.length>2?((StaffExperience)(experiences[2])).getStart():"" %>""/></td>
    			<td><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffExperienceEnd3" value="<%=experiences.length>2?((StaffExperience)(experiences[2])).getEnd():"" %>"/></td>
    			<td><input type="text" name="staffDTO.staffExperienceUnit3" value="<%=experiences.length>2?((StaffExperience)(experiences[2])).getUnit():"" %>"/></td>
    			<td colspan="2"><input type="text" name="staffDTO.staffExperiencePost3" value="<%=experiences.length>2?((StaffExperience)(experiences[2])).getPost():"" %>"/></td>
    		</tr>

			<%
				Object[] certificates = new StaffCertificate[0];
				if(request.getAttribute("certificateSet")!=null){
					certificates = ((Set)request.getAttribute("certificateSet")).toArray();
				}
			 %>
    		<tr>
    			<td rowspan="4" style="font-size:20px" bgcolor="#eef6ff">所&nbsp;获&nbsp;证&nbsp;书</td>
    			<td >证书名称</td>
    			<td >获得时间</td>
    			<td >起始有效时间</td>
    			<td  colspan="2">终止有效时间</td>
    			
    		</tr>
    		<tr>
    			<td><input type="text" name="staffDTO.staffCertificateName1" value="<%=certificates.length>0?((StaffCertificate)(certificates[0])).getName():"" %>"/></td>
    			<td><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffCertificateIssueDate1" value="<%=certificates.length>0?((StaffCertificate)(certificates[0])).getIssueDate():"" %>"/></td>
    			<td><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffCertificateNotbefore1" value="<%=certificates.length>0?((StaffCertificate)(certificates[0])).getNotbefore():"" %>"/></td>
    			<td colspan="2"><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffCertificateNotafter1" value="<%=certificates.length>0?((StaffCertificate)(certificates[0])).getNotafter():"" %>"/></td>
    		</tr>
    		<tr>
    			<td><input type="text" name="staffDTO.staffCertificateName2" value="<%=certificates.length>1?((StaffCertificate)(certificates[1])).getName():"" %>"/></td>
    			<td><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffCertificateIssueDate2" value="<%=certificates.length>1?((StaffCertificate)(certificates[1])).getIssueDate():"" %>"/></td>
    			<td><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffCertificateNotbefore2" value="<%=certificates.length>1?((StaffCertificate)(certificates[1])).getNotbefore():"" %>"/></td>
    			<td colspan="2"><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffCertificateNotafter2" value="<%=certificates.length>1?((StaffCertificate)(certificates[1])).getIssueDate():"" %>"/></td>
    		</tr>
    		<tr>
    			<td><input type="text" name="staffDTO.staffCertificateName3" value="<%=certificates.length>2?((StaffCertificate)(certificates[2])).getName():"" %>"/></td>
    			<td><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffCertificateIssueDate3" value="<%=certificates.length>2?((StaffCertificate)(certificates[2])).getIssueDate():"" %>"/></td>
    			<td><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffCertificateNotbefore3" value="<%=certificates.length>2?((StaffCertificate)(certificates[2])).getNotbefore():"" %>"/></td>
    			<td colspan="2"><input type="text" class="Wdate" onClick="WdatePicker()" name="staffDTO.staffCertificateNotafter3" value="<%=certificates.length>2?((StaffCertificate)(certificates[2])).getIssueDate():"" %>"/></td>
    		</tr>
			</tbody>
    		<tfoot>
				<td colspan="6" align="centet" height="45px">
			    	<s:if test="staffId!=null">
			    		<input type="text" name="staffId" value="${staffId}" style="display: none;"/>
			    	</s:if>
		    		<input class="submit" type="submit" value="提交"  />
		    		<input class="reset" type="reset" value="重置" />
				</td>
			</tfoot>
    	</table>			
    </form>
</body>
  </center>
</html>